
import React from "react";
import {Form, Radio} from "antd";
import { observer } from 'mobx-react';

/**
 * 单选框
 */
@observer
class FormRadio extends React.Component{
    constructor(props) {
        super(props);
        this.state={}
    }

    render() {
        const {getFieldDecorator} = this.props.form;
        const {label,field,initialValue,rules,options,store} = this.props;
        return (
            <Form.Item label={label ? label : "单选框"}>
                {getFieldDecorator(field ? field : 'default_check_box', {initialValue: initialValue,rules: rules ? rules : []})(
                    <Radio.Group>
                        {
                            Object.keys(options ? options : {}).map(key => (
                                <Radio key={key} value={key}>{options[key]}</Radio>
                            ))
                        }
                    </Radio.Group>
                )}
            </Form.Item>
        );
    }
}

export default FormRadio;
